package top.hesisi.springboot3.entity.auth;

import com.baomidou.mybatisplus.annotation.*;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import top.hesisi.springboot3.validate.CommonValidate;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

@Data
@TableName("tb_user_info")
public class TbUserInfo implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    // 自增主键
    @TableId(type = IdType.INPUT)
    @NotNull(message = "编号必须填写", groups = {CommonValidate.class})
    @Min(value = 1,message = "编号必须大于0",groups = {CommonValidate.class})
    private Integer id;

    private String sex;
    private String info;
    //正则校验
    @Pattern(message = "手机号码格式不正确",regexp = CommonValidate.PHONE,groups = {CommonValidate.class})
    private String phone;
    @Pattern(message = "邮箱码格式不正确",regexp = CommonValidate.EMAIL,groups = {CommonValidate.class})
    private String email;
    private String imgurl;
    @TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER)
    private Date lastupdate;
}
